a11y: restore window:activate/deactivate emission
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Fri, 23 Mar 2018 17:33:58 +0000 (18:33 +0100)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Thu, 5 Apr 2018 13:19:04 +0000 (15:19 +0200)
1b9aa1b708c2 ('a11y: drop the focus tracker') removed a bit too much.  We
still have to emit window:activate/deactivate events.  They are easy to
emit anyway.

Fixes #127

gtk/a11y/gtkaccessibility.h
gtk/a11y/gtkwindowaccessible.c
gtk/gtkwindow.c

index c3df055dec2861420f5702f633bddc4c7855c649..a62a13f8b18f8540dbfc71c42d5138cc02f0ad13 100644 (file)
 
 G_BEGIN_DECLS
 
-void      _gtk_accessibility_init        (void);
+void      _gtk_accessibility_init              (void);
 
-gboolean  _gtk_accessibility_key_snooper (GtkWidget   *widget,
-                                          GdkEventKey *event);
+gboolean  _gtk_accessibility_key_snooper       (GtkWidget   *widget,
+                                                GdkEventKey *event);
+
+void      _gtk_window_accessible_set_is_active (GtkWindow   *window,
+                                                gboolean     is_active);
 
 G_END_DECLS
 
index aeb0ee961dcf09bdb242c3087a84e5cff9f4e815..a05f5942cf69172ab3741cbce5118400aff4e23e 100644 (file)
 
 #include <gtk/gtk.h>
 
+#include "gtkaccessibility.h"
 #include "gtkwidgetaccessibleprivate.h"
 #include "gtkwindowaccessible.h"
 #include "gtktoplevelaccessible.h"
+#include "gtkwidgetprivate.h"
 #include "gtkwindowprivate.h"
 
 /* atkcomponent.h */
@@ -442,6 +444,19 @@ gtk_window_accessible_get_size (AtkComponent *component,
   *height = rect.height;
 }
 
+void
+_gtk_window_accessible_set_is_active (GtkWindow   *window,
+                                      gboolean     is_active)
+{
+  AtkObject *accessible = _gtk_widget_peek_accessible (GTK_WIDGET (window));
+
+  if (accessible == NULL)
+    return;
+
+  g_signal_emit_by_name (accessible, is_active ? "activate" : "deactivate");
+}
+
+
 static void
 atk_component_interface_init (AtkComponentIface *iface)
 {
index c5ef1ec4f3e2d8c4b1483cafa6a0e9b0cb453aec..9e2cfc23633d706386d32e7b71d20ac980b218b4 100644 (file)
@@ -10472,6 +10472,7 @@ _gtk_window_set_is_active (GtkWindow *window,
         }
 
       g_object_notify_by_pspec (G_OBJECT (window), window_props[PROP_IS_ACTIVE]);
+      _gtk_window_accessible_set_is_active (window, is_active);
     }
 }